home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 2010 April / PCWorld0410.iso / hity wydania / Ubuntu 9.10 PL / karmelkowy-koliberek-desktop-9.10-i386-PL.iso / casper / filesystem.squashfs / usr / share / hplip / prnt / pcl.pyc (.txt) < prev   
Python Compiled Bytecode  |  2009-10-28  |  2KB  |  75 lines

  1. # Source Generated with Decompyle++
  2. # File: in.pyc (Python 2.6)
  3.  
  4. import struct
  5. from base import pml
  6. ESC = '\x1b'
  7. RESET = '\x1bE'
  8. UEL = '\x1b%-12345X'
  9. PJL_ENTER_LANG = '@PJL ENTER LANGUAGE=PCL3GUI\n'
  10. PJL_BEGIN_JOB = '@PJL JOB NAME="unnamed"\n'
  11. PJL_END_JOB = '@PJL EOJ\n'
  12.  
  13. def buildPCLCmd(punc, letter1, letter2, data = None, value = None):
  14.     if data is None:
  15.         return ''.join([
  16.             ESC,
  17.             punc,
  18.             letter1,
  19.             str(value),
  20.             letter2])
  21.     return ''.join([
  22.         ESC,
  23.         punc,
  24.         letter1,
  25.         str(len(data)),
  26.         letter2,
  27.         data])
  28.  
  29.  
  30. def buildEmbeddedPML(pml):
  31.     return ''.join([
  32.         UEL,
  33.         PJL_ENTER_LANG,
  34.         RESET,
  35.         pml,
  36.         RESET,
  37.         UEL])
  38.  
  39.  
  40. def buildEmbeddedPML2(pml):
  41.     return ''.join([
  42.         RESET,
  43.         UEL,
  44.         PJL_BEGIN_JOB,
  45.         PJL_ENTER_LANG,
  46.         RESET,
  47.         pml,
  48.         RESET,
  49.         PJL_END_JOB,
  50.         RESET,
  51.         UEL])
  52.  
  53.  
  54. def buildDynamicCounter(counter):
  55.     return ''.join([
  56.         UEL,
  57.         PJL_ENTER_LANG,
  58.         ESC,
  59.         '*o5W\xc0\x01',
  60.         struct.pack('>I', counter)[1:],
  61.         PJL_END_JOB,
  62.         UEL])
  63.  
  64.  
  65. def buildRP(a, b, c, d, e):
  66.     return ''.join([
  67.         '\x00' * 600,
  68.         RESET,
  69.         UEL,
  70.         PJL_ENTER_LANG,
  71.         buildPCLCmd('&', 'b', 'W', pml.buildEmbeddedPMLSetPacket('1.1.1.36', a + b + c + d + e, pml.TYPE_STRING)),
  72.         RESET,
  73.         UEL])
  74.  
  75.